﻿using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.StartCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.StartCommandHandler
{
    /// <summary>
    /// 期初反填CommandHandler
    /// </summary>
    public class StartByIdCommandHandler : IRequestHandler<StartByIdCommand, Results<StartOutput>>
    {


        private readonly IStartService _service;
        public StartByIdCommandHandler(IStartService service)
        {
            _service = service;
        }



        public async Task<Results<StartOutput>> Handle(StartByIdCommand request, CancellationToken cancellationToken)
        {
             var list =await _service.GetStartByIdAsync(request.StartId);
            return Results<StartOutput>.DataResult(list);
        }
    }
}
